// Do Not pass t.* to function when it sounds up! If pressed, then kill and "t.start" again. Enjoy :) t.start; t.pause; t.resume; t.reset; t.stop; //double click me first at below :) ( //Synthesizers ( // sine wave osc SynthDef("sine", { arg freq, amp = 0; var osc; osc = SinOsc.ar(freq, 0, amp.lag(0.2)).dup; Out.ar(0, osc); }).send(s); //WhiteNoise SynthDef("whitenoise", {arg amp = 0; var noise; noise = WhiteNoise.ar(amp).dup; Out.ar(0, noise); }).send(s); //LPF SynthDef("whitenoiselpf", {arg freq = 20000, amp = 0; var lpf, in; in = WhiteNoise.ar(amp).dup; lpf = LPF.ar(in, freq, 1); Out.ar(0, lpf); }).send(s); //HPF SynthDef("whitenoisehpf", {arg freq=30, amp = 0; var hpf, in; in = WhiteNoise.ar(amp).dup; hpf = HPF.ar(in, freq, 1); Out.ar(0, hpf); }).send(s); ); // Task ( t = Task({ var freq, change, interval; interval = 5; // Section 1 ("Section 1").postln; a = Synth(\sine); 10.do({ var freq; freq = [100, 200, 300, 400, 440, 500, 880, 1000, 1760, 5000, 8000].choose; a.set(\freq, freq, \amp, 0.2); interval.wait; a.set(\amp, 0); ("This is"+freq+"Hz.").postln; interval.wait;} ); // Section 2 ("Section 2").postln; 10.do({ var change; change = [-1.5, -3, -6, -9, -12, -18, -24, 0, 1.5, 3, 6, 9, 12].choose; a.set(\freq, 1000, \amp, -12.dbamp); interval.wait; a.set(\freq, 1000, \amp, (-12 + change).dbamp); interval.wait; a.set(\amp, 0); if(change < 0, {("-" + change.abs + "dB difference").postln;}, {("+"+change+"dB difference").postln;}; ); interval.wait;} ); // Section 3 ("Section 3").postln; 10.do({ var freq, change; change = [-1.5, -3, -6, -9, -12, -18, -24, 0, 1.5, 3, 6, 9, 12].choose; freq = [100, 200, 300, 400, 440, 500, 880, 1000, 1760, 5000, 8000].choose; a.set(\freq, freq, \amp, -12.dbamp); interval.wait; a.set(\freq, freq, \amp, (-12 + change).dbamp); interval.wait; a.set(\amp, 0); if(change < 0, {(freq+"Hz,"+"-"+change.abs+"dB difference").postln;}, {(freq+"Hz,"+"+"+change+"dB difference").postln;}; ); interval.wait;} ); // Section 4 ("Section 4").postln; b = Synth(\whitenoise); 10.do({ var change; change = [-1.5, -3, -6, -9, -12, -18, -24, 0, 1.5, 3, 6, 9, 12].choose; b.set(\amp, -12.dbamp); interval.wait; b.set(\amp, (-12 + change).dbamp); interval.wait; b.set(\amp, 0); if(change < 0, {("-"+change.abs+"dB difference").postln;}, {("+"+change+"dB difference").postln;}; ); interval.wait;} ); // Section 5 ("Section 5").postln; c = Synth(\whitenoiselpf); 10.do({ var freq; freq = [200, 1000, 2000, 5000].choose; c.set(\freq, freq, \amp, 0.2); interval.wait; c.set(\amp, 0); ("The cutoff Frequency is"+freq+"Hz.").postln; interval.wait;}; ); // Section 6 ("Section 6").postln; d = Synth(\whitenoisehpf); 10.do({ var freq; freq = [200, 1000, 2000, 5000].choose; d.set(\freq, freq, \amp, 0.2); interval.wait; d.set(\amp, 0); ("The cutoff Frequency is"+freq+"Hz.").postln; interval.wait;}; ); }); ) )